/*
 * ImageAnalyzerView.java
 */

package imageanalyzer;

import guiutilities.jCompressionAlgorithmDialog;
import guiutilities.jDirectionDialog;
import guiutilities.jFiveDoubleArgumentDialog;
import guiutilities.jFourDoubleArgumentDialog;
import guiutilities.jRawImageDialog;
import guiutilities.jSingleArgumentDialog;
import guiutilities.jSingleDoubleArgumentDialog;
import guiutilities.jSixDoubleArgumentDialog;
import guiutilities.jSliderDialog;
import guiutilities.jSusanDialog;
import guiutilities.jTwoArgumentDialog;
import guiutilities.jTwoDoubleArgumentDialog;
import image.diffussion.AnisotropicDiffussion;
import image.diffussion.Diffusion;
import image.diffussion.IsotropicDiffussion;
import image.edge.AEdgeDetector;
import image.edge.BKirshEdgeDetector;
import image.edge.CEdgeDetector;
import image.edge.CannyEdgeDetector;
import image.edge.DEdgeDetector;
import image.edge.EdgeDetector;
import image.edge.HarrisCornerDetector;
import image.edge.LogEdgeDetector;
import image.edge.PrewittEdgeDetector;
import image.edge.RobertsEdgeDetector;
import image.edge.SobelEdgeDetector;
import image.edge.SusanEdgeDetector;
import image.edge.SusanEdgeDetector.SUSAN_TYPES;
import image.edge.ZeroCrossEdgeDetection;
import image.filter.Filter;
import image.filter.GaussianFilter;
import image.filter.HighPassFilter;
import image.filter.MeanFilter;
import image.filter.MedianFilter;
import image.generators.ShapesGenerators;
import image.histogram.Histogram;
import image.lines.Hough;
import image.lines.HoughCircles;
import image.noise.generators.BlankAdditiveGaussianNoise;
import image.noise.generators.MultiplicativeExponentialNoise;
import image.noise.generators.MultiplicativeRayleighNoise;
import image.noise.generators.SaltAndPepperNoise;
import image.processing.ImageProcessor;
import image.threshold.GlobalThresholder;
import image.threshold.OtsuThresholderA;
import image.utils.ImageFileFilter;
import image.utils.ImageUtilities;
import image.utils.ImageUtilitiesImpl;
import java.awt.Color;
import java.awt.Dimension;
import java.io.IOException;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JColorChooser;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * The application's main frame.
 */
public class ImageAnalyzerView extends FrameView {
	private ImageUtilities imgUtil;
	private BufferedImage processImage;
	private boolean confirmOperation;
	private Histogram imageHistogram;
	private File imgFile;
	
    public ImageAnalyzerView(SingleFrameApplication app) {
        super(app);

        initComponents();
		initCustomComponents();
        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = ImageAnalyzerApp.getApplication().getMainFrame();
            aboutBox = new ImageAnalyzerAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        ImageAnalyzerApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jImageShowCaseDPane = new javax.swing.JDesktopPane();
        jImageShowCasePanel = new javax.swing.JPanel();
        jImageContainer = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        jMenuItemOpen = new javax.swing.JMenuItem();
        jMenuItemSaveImage = new javax.swing.JMenuItem();
        jMenuItemSaveImageAs = new javax.swing.JMenuItem();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        jMenuOperations = new javax.swing.JMenu();
        jMenuItemAddImages = new javax.swing.JMenuItem();
        jMenuItemSubImages = new javax.swing.JMenuItem();
        jMenuItemProduct = new javax.swing.JMenuItem();
        jMenuItemScalarProduct = new javax.swing.JMenuItem();
        jMenuItemNegative = new javax.swing.JMenuItem();
        jMenuItemEqualize = new javax.swing.JMenuItem();
        jMenuItemDRangeCompression = new javax.swing.JMenuItem();
        jMenuItemThreshold = new javax.swing.JMenuItem();
        jMenuItemGreyScaleDegrade = new javax.swing.JMenuItem();
        jMenuItemColorDegrade = new javax.swing.JMenuItem();
        jMenuNoise = new javax.swing.JMenu();
        jMenuItemGaussianNoise = new javax.swing.JMenuItem();
        jMenuItemMultExponentialNoise = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItemSaltAndPepper = new javax.swing.JMenuItem();
        jMenuFilters = new javax.swing.JMenu();
        jMenuItemMeanFilter = new javax.swing.JMenuItem();
        jMenuItemMedianFilter = new javax.swing.JMenuItem();
        jMenuItemHighPassFilter = new javax.swing.JMenuItem();
        jMenuItemGaussianFilter = new javax.swing.JMenuItem();
        jMenuEdges = new javax.swing.JMenu();
        jMenuItemRobertsEdgeDetection = new javax.swing.JMenuItem();
        jMenuItemPrewittEdgeDetection = new javax.swing.JMenuItem();
        jMenuItemSobelEdgeDetection = new javax.swing.JMenuItem();
        jMenuItemLaplacianEdgeDetector = new javax.swing.JMenuItem();
        jLogEdgeDetectionMenuItem = new javax.swing.JMenuItem();
        jCannyEdgeDetectionMenuItem = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuCorners = new javax.swing.JMenu();
        jMenuItemHarris = new javax.swing.JMenuItem();
        jMenuDiffusion = new javax.swing.JMenu();
        jMenuItemIsotropicDiffusion = new javax.swing.JMenuItem();
        jMenuItemAnisotropicDiffussion = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuStatistics = new javax.swing.JMenu();
        jMenuItemHistogram = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jImageFileChooser = new javax.swing.JFileChooser();

        mainPanel.setName("mainPanel"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(imageanalyzer.ImageAnalyzerApp.class).getContext().getResourceMap(ImageAnalyzerView.class);
        jImageShowCaseDPane.setBackground(resourceMap.getColor("jImageShowCaseDPane.background")); // NOI18N
        jImageShowCaseDPane.setAutoscrolls(true);
        jImageShowCaseDPane.setName("jImageShowCaseDPane"); // NOI18N

        jImageShowCasePanel.setBackground(resourceMap.getColor("jImageShowCasePanel.background")); // NOI18N
        jImageShowCasePanel.setName("jImageShowCasePanel"); // NOI18N

        jImageContainer.setText(resourceMap.getString("jImageContainer.text")); // NOI18N
        jImageContainer.setName("jImageContainer"); // NOI18N

        javax.swing.GroupLayout jImageShowCasePanelLayout = new javax.swing.GroupLayout(jImageShowCasePanel);
        jImageShowCasePanel.setLayout(jImageShowCasePanelLayout);
        jImageShowCasePanelLayout.setHorizontalGroup(
            jImageShowCasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jImageShowCasePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jImageContainer, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                .addContainerGap(408, Short.MAX_VALUE))
        );
        jImageShowCasePanelLayout.setVerticalGroup(
            jImageShowCasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jImageShowCasePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jImageContainer, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
                .addContainerGap(243, Short.MAX_VALUE))
        );

        jImageShowCasePanel.setBounds(10, 10, 530, 330);
        jImageShowCaseDPane.add(jImageShowCasePanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jImageShowCaseDPane)
                .addContainerGap(359, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jImageShowCaseDPane))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        jMenuItemOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemOpen.setText(resourceMap.getString("jMenuItemOpen.text")); // NOI18N
        jMenuItemOpen.setName("jMenuItemOpen"); // NOI18N
        jMenuItemOpen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemOpenActionPerformed(evt);
            }
        });
        fileMenu.add(jMenuItemOpen);

        jMenuItemSaveImage.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemSaveImage.setText(resourceMap.getString("jMenuItemSaveImage.text")); // NOI18N
        jMenuItemSaveImage.setName("jMenuItemSaveImage"); // NOI18N
        jMenuItemSaveImage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSaveImageActionPerformed(evt);
            }
        });
        fileMenu.add(jMenuItemSaveImage);

        jMenuItemSaveImageAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemSaveImageAs.setText(resourceMap.getString("jMenuItemSaveImageAs.text")); // NOI18N
        jMenuItemSaveImageAs.setName("jMenuItemSaveImageAs"); // NOI18N
        jMenuItemSaveImageAs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSaveImageAsActionPerformed(evt);
            }
        });
        fileMenu.add(jMenuItemSaveImageAs);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(imageanalyzer.ImageAnalyzerApp.class).getContext().getActionMap(ImageAnalyzerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        jMenuOperations.setText(resourceMap.getString("jMenuOperations.text")); // NOI18N
        jMenuOperations.setName("jMenuOperations"); // NOI18N

        jMenuItemAddImages.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemAddImages.setText(resourceMap.getString("jMenuItemAddImages.text")); // NOI18N
        jMenuItemAddImages.setName("jMenuItemAddImages"); // NOI18N
        jMenuItemAddImages.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAddImagesActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemAddImages);

        jMenuItemSubImages.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemSubImages.setText(resourceMap.getString("jMenuItemSubImages.text")); // NOI18N
        jMenuItemSubImages.setName("jMenuItemSubImages"); // NOI18N
        jMenuItemSubImages.setPreferredSize(new java.awt.Dimension(150, 23));
        jMenuItemSubImages.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSubImagesActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemSubImages);

        jMenuItemProduct.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemProduct.setText(resourceMap.getString("jMenuItemProduct.text")); // NOI18N
        jMenuItemProduct.setName("jMenuItemProduct"); // NOI18N
        jMenuItemProduct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemProductActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemProduct);

        jMenuItemScalarProduct.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemScalarProduct.setText(resourceMap.getString("jMenuItemScalarProduct.text")); // NOI18N
        jMenuItemScalarProduct.setName("jMenuItemScalarProduct"); // NOI18N
        jMenuItemScalarProduct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemScalarProductActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemScalarProduct);

        jMenuItemNegative.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemNegative.setText(resourceMap.getString("jMenuItemNegative.text")); // NOI18N
        jMenuItemNegative.setName("jMenuItemNegative"); // NOI18N
        jMenuItemNegative.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemNegativeActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemNegative);

        jMenuItemEqualize.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemEqualize.setText(resourceMap.getString("jMenuItemEqualize.text")); // NOI18N
        jMenuItemEqualize.setName("jMenuItemEqualize"); // NOI18N
        jMenuItemEqualize.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemEqualizeActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemEqualize);

        jMenuItemDRangeCompression.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemDRangeCompression.setText(resourceMap.getString("jMenuItemDRangeCompression.text")); // NOI18N
        jMenuItemDRangeCompression.setName("jMenuItemDRangeCompression"); // NOI18N
        jMenuItemDRangeCompression.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDRangeCompressionActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemDRangeCompression);

        jMenuItemThreshold.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemThreshold.setText(resourceMap.getString("jMenuItemThreshold.text")); // NOI18N
        jMenuItemThreshold.setName("jMenuItemThreshold"); // NOI18N
        jMenuItemThreshold.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemThresholdActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemThreshold);

        jMenuItemGreyScaleDegrade.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemGreyScaleDegrade.setText(resourceMap.getString("jMenuItemGreyScaleDegrade.text")); // NOI18N
        jMenuItemGreyScaleDegrade.setName("jMenuItemGreyScaleDegrade"); // NOI18N
        jMenuItemGreyScaleDegrade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemGreyScaleDegradeActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemGreyScaleDegrade);

        jMenuItemColorDegrade.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemColorDegrade.setText(resourceMap.getString("jMenuItemColorDegrade.text")); // NOI18N
        jMenuItemColorDegrade.setName("jMenuItemColorDegrade"); // NOI18N
        jMenuItemColorDegrade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemColorDegradeActionPerformed(evt);
            }
        });
        jMenuOperations.add(jMenuItemColorDegrade);

        menuBar.add(jMenuOperations);

        jMenuNoise.setText(resourceMap.getString("jMenuNoise.text")); // NOI18N
        jMenuNoise.setName("jMenuNoise"); // NOI18N

        jMenuItemGaussianNoise.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemGaussianNoise.setText(resourceMap.getString("jMenuItemGaussianNoise.text")); // NOI18N
        jMenuItemGaussianNoise.setName("jMenuItemGaussianNoise"); // NOI18N
        jMenuItemGaussianNoise.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemGaussianNoiseActionPerformed(evt);
            }
        });
        jMenuNoise.add(jMenuItemGaussianNoise);

        jMenuItemMultExponentialNoise.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemMultExponentialNoise.setText(resourceMap.getString("jMenuItemMultExponentialNoise.text")); // NOI18N
        jMenuItemMultExponentialNoise.setName("jMenuItemMultExponentialNoise"); // NOI18N
        jMenuItemMultExponentialNoise.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemMultExponentialNoiseActionPerformed(evt);
            }
        });
        jMenuNoise.add(jMenuItemMultExponentialNoise);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenuNoise.add(jMenuItem1);

        jMenuItemSaltAndPepper.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemSaltAndPepper.setText(resourceMap.getString("jMenuItemSaltAndPepper.text")); // NOI18N
        jMenuItemSaltAndPepper.setName("jMenuItemSaltAndPepper"); // NOI18N
        jMenuItemSaltAndPepper.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSaltAndPepperActionPerformed(evt);
            }
        });
        jMenuNoise.add(jMenuItemSaltAndPepper);

        menuBar.add(jMenuNoise);

        jMenuFilters.setText(resourceMap.getString("jMenuFilters.text")); // NOI18N
        jMenuFilters.setName("jMenuFilters"); // NOI18N

        jMenuItemMeanFilter.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemMeanFilter.setText(resourceMap.getString("jMenuItemMeanFilter.text")); // NOI18N
        jMenuItemMeanFilter.setName("jMenuItemMeanFilter"); // NOI18N
        jMenuItemMeanFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemMeanFilterActionPerformed(evt);
            }
        });
        jMenuFilters.add(jMenuItemMeanFilter);

        jMenuItemMedianFilter.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemMedianFilter.setText(resourceMap.getString("jMenuItemMedianFilter.text")); // NOI18N
        jMenuItemMedianFilter.setName("jMenuItemMedianFilter"); // NOI18N
        jMenuItemMedianFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemMedianFilterActionPerformed(evt);
            }
        });
        jMenuFilters.add(jMenuItemMedianFilter);

        jMenuItemHighPassFilter.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemHighPassFilter.setText(resourceMap.getString("jMenuItemHighPassFilter.text")); // NOI18N
        jMenuItemHighPassFilter.setName("jMenuItemHighPassFilter"); // NOI18N
        jMenuItemHighPassFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemHighPassFilterActionPerformed(evt);
            }
        });
        jMenuFilters.add(jMenuItemHighPassFilter);

        jMenuItemGaussianFilter.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemGaussianFilter.setText(resourceMap.getString("jMenuItemGaussianFilter.text")); // NOI18N
        jMenuItemGaussianFilter.setName("jMenuItemGaussianFilter"); // NOI18N
        jMenuItemGaussianFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemGaussianFilterActionPerformed(evt);
            }
        });
        jMenuFilters.add(jMenuItemGaussianFilter);

        menuBar.add(jMenuFilters);

        jMenuEdges.setText(resourceMap.getString("jMenuEdges.text")); // NOI18N
        jMenuEdges.setName("jMenuEdges"); // NOI18N

        jMenuItemRobertsEdgeDetection.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemRobertsEdgeDetection.setText(resourceMap.getString("jMenuItemRobertsEdgeDetection.text")); // NOI18N
        jMenuItemRobertsEdgeDetection.setName("jMenuItemRobertsEdgeDetection"); // NOI18N
        jMenuItemRobertsEdgeDetection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemRobertsEdgeDetectionActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItemRobertsEdgeDetection);

        jMenuItemPrewittEdgeDetection.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemPrewittEdgeDetection.setText(resourceMap.getString("jMenuItemPrewittEdgeDetection.text")); // NOI18N
        jMenuItemPrewittEdgeDetection.setName("jMenuItemPrewittEdgeDetection"); // NOI18N
        jMenuItemPrewittEdgeDetection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemPrewittEdgeDetectionActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItemPrewittEdgeDetection);

        jMenuItemSobelEdgeDetection.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemSobelEdgeDetection.setText(resourceMap.getString("jMenuItemSobelEdgeDetection.text")); // NOI18N
        jMenuItemSobelEdgeDetection.setName("jMenuItemSobelEdgeDetection"); // NOI18N
        jMenuItemSobelEdgeDetection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSobelEdgeDetectionActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItemSobelEdgeDetection);

        jMenuItemLaplacianEdgeDetector.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItemLaplacianEdgeDetector.setText(resourceMap.getString("jMenuItemLaplacianEdgeDetector.text")); // NOI18N
        jMenuItemLaplacianEdgeDetector.setName("jMenuItemLaplacianEdgeDetector"); // NOI18N
        jMenuItemLaplacianEdgeDetector.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemLaplacianEdgeDetectorActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItemLaplacianEdgeDetector);

        jLogEdgeDetectionMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jLogEdgeDetectionMenuItem.setText(resourceMap.getString("jLogEdgeDetectionMenuItem.text")); // NOI18N
        jLogEdgeDetectionMenuItem.setName("jLogEdgeDetectionMenuItem"); // NOI18N
        jLogEdgeDetectionMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jLogEdgeDetectionMenuItemActionPerformed(evt);
            }
        });
        jMenuEdges.add(jLogEdgeDetectionMenuItem);

        jCannyEdgeDetectionMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jCannyEdgeDetectionMenuItem.setText(resourceMap.getString("jCannyEdgeDetectionMenuItem.text")); // NOI18N
        jCannyEdgeDetectionMenuItem.setName("jCannyEdgeDetectionMenuItem"); // NOI18N
        jCannyEdgeDetectionMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCannyEdgeDetectionMenuItemActionPerformed(evt);
            }
        });
        jMenuEdges.add(jCannyEdgeDetectionMenuItem);

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N
        jMenuItem3.setName("jMenuItem3"); // NOI18N
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItem3);

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem4.setText(resourceMap.getString("jMenuItem4.text")); // NOI18N
        jMenuItem4.setName("jMenuItem4"); // NOI18N
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItem4);

        jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N
        jMenuItem5.setName("jMenuItem5"); // NOI18N
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItem5);

        jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem6.setText(resourceMap.getString("jMenuItem6.text")); // NOI18N
        jMenuItem6.setName("jMenuItem6"); // NOI18N
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItem6);

        jMenuItem9.setText(resourceMap.getString("jMenuItem9.text")); // NOI18N
        jMenuItem9.setName("jMenuItem9"); // NOI18N
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItem9);

        jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenuEdges.add(jMenuItem2);

        menuBar.add(jMenuEdges);

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jMenuItem7.setText(resourceMap.getString("jMenuItem7.text")); // NOI18N
        jMenuItem7.setName("jMenuItem7"); // NOI18N
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem7);

        jMenuItem8.setText(resourceMap.getString("jMenuItem8.text")); // NOI18N
        jMenuItem8.setName("jMenuItem8"); // NOI18N
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem8);

        menuBar.add(jMenu1);

        jMenuCorners.setText(resourceMap.getString("jMenuCorners.text")); // NOI18N
        jMenuCorners.setName("jMenuCorners"); // NOI18N

        jMenuItemHarris.setText(resourceMap.getString("jMenuItemHarris.text")); // NOI18N
        jMenuItemHarris.setName("jMenuItemHarris"); // NOI18N
        jMenuItemHarris.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemHarrisActionPerformed(evt);
            }
        });
        jMenuCorners.add(jMenuItemHarris);

        menuBar.add(jMenuCorners);

        jMenuDiffusion.setText(resourceMap.getString("jMenuDiffusion.text")); // NOI18N
        jMenuDiffusion.setName("jMenuDiffusion"); // NOI18N

        jMenuItemIsotropicDiffusion.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        jMenuItemIsotropicDiffusion.setText(resourceMap.getString("jMenuItemIsotropicDiffusion.text")); // NOI18N
        jMenuItemIsotropicDiffusion.setName("jMenuItemIsotropicDiffusion"); // NOI18N
        jMenuItemIsotropicDiffusion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemIsotropicDiffusionActionPerformed(evt);
            }
        });
        jMenuDiffusion.add(jMenuItemIsotropicDiffusion);

        jMenuItemAnisotropicDiffussion.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F2, 0));
        jMenuItemAnisotropicDiffussion.setText(resourceMap.getString("jMenuItemAnisotropicDiffussion.text")); // NOI18N
        jMenuItemAnisotropicDiffussion.setName("jMenuItemAnisotropicDiffussion"); // NOI18N
        jMenuItemAnisotropicDiffussion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAnisotropicDiffussionActionPerformed(evt);
            }
        });
        jMenuDiffusion.add(jMenuItemAnisotropicDiffussion);

        menuBar.add(jMenuDiffusion);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jMenuItem10.setText(resourceMap.getString("jMenuItem10.text")); // NOI18N
        jMenuItem10.setName("jMenuItem10"); // NOI18N
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem10);

        jMenuItem11.setText(resourceMap.getString("jMenuItem11.text")); // NOI18N
        jMenuItem11.setName("jMenuItem11"); // NOI18N
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem11);

        menuBar.add(jMenu2);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N

        jMenuItem12.setText(resourceMap.getString("jMenuItem12.text")); // NOI18N
        jMenuItem12.setName("jMenuItem12"); // NOI18N
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem12);

        jMenuItem13.setText(resourceMap.getString("jMenuItem13.text")); // NOI18N
        jMenuItem13.setName("jMenuItem13"); // NOI18N
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem13);

        jMenuItem14.setText(resourceMap.getString("jMenuItem14.text")); // NOI18N
        jMenuItem14.setName("jMenuItem14"); // NOI18N
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem14ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem14);

        jMenuItem15.setText(resourceMap.getString("jMenuItem15.text")); // NOI18N
        jMenuItem15.setName("jMenuItem15"); // NOI18N
        jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem15ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem15);

        jMenuItem17.setText(resourceMap.getString("jMenuItem17.text")); // NOI18N
        jMenuItem17.setName("jMenuItem17"); // NOI18N
        jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem17ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem17);

        jMenuItem16.setText(resourceMap.getString("jMenuItem16.text")); // NOI18N
        jMenuItem16.setName("jMenuItem16"); // NOI18N
        jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem16ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem16);

        jMenuItem18.setText(resourceMap.getString("jMenuItem18.text")); // NOI18N
        jMenuItem18.setName("jMenuItem18"); // NOI18N
        jMenuItem18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem18ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem18);

        menuBar.add(jMenu3);

        jMenuStatistics.setText(resourceMap.getString("jMenuStatistics.text")); // NOI18N
        jMenuStatistics.setName("jMenuStatistics"); // NOI18N

        jMenuItemHistogram.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemHistogram.setText(resourceMap.getString("jMenuItemHistogram.text")); // NOI18N
        jMenuItemHistogram.setName("jMenuItemHistogram"); // NOI18N
        jMenuItemHistogram.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemHistogramActionPerformed(evt);
            }
        });
        jMenuStatistics.add(jMenuItemHistogram);

        menuBar.add(jMenuStatistics);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 653, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 457, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        jImageFileChooser.setName("jImageFileChooser"); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

	private void initCustomComponents() {
		imgUtil = ImageUtilitiesImpl.getInstance();
		jImageFileChooser.setAcceptAllFileFilterUsed(false);
		jImageFileChooser.setFileFilter(new ImageFileFilter());
	}
	
	private void jMenuItemOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemOpenActionPerformed
		int chooseOption = jImageFileChooser.showOpenDialog(menuBar);
		
		if ((chooseOption == JFileChooser.APPROVE_OPTION)) {
			try {
				imgFile = jImageFileChooser.getSelectedFile();
				this.processImage = GUIImageOpenManagement(imgFile);
				this.imageHistogram = new Histogram(this.processImage);
				displayImage();
			} catch (IOException ex) {
				JOptionPane.showMessageDialog(getFrame(), ex.getMessage());
			} catch (ArrayIndexOutOfBoundsException ex) {
				JOptionPane.showMessageDialog(getFrame(), "RAW Image Dimensions wrong!");
			}
			
		} else {
			System.out.println("User Cancelled");
		}
	}//GEN-LAST:event_jMenuItemOpenActionPerformed

	private void jMenuItemAddImagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddImagesActionPerformed
		//jIFrameBrowseImages.setVisible(true);
		BufferedImage operand;
		int chooseOption = jImageFileChooser.showOpenDialog(menuBar);
		ImageProcessor.CompressAlgorithm selectedAlgorithm;
		
		if ((chooseOption == JFileChooser.APPROVE_OPTION)) {
			try {
				File imageFile = jImageFileChooser.getSelectedFile();
				operand = GUIImageOpenManagement(imageFile);
				selectedAlgorithm = AlgorithmSelectionManager();
				this.processImage = ImageProcessor.add(this.processImage, operand, selectedAlgorithm);
				this.imageHistogram = new Histogram(this.processImage);
				displayImage();
			} catch (IOException ex) {
				JOptionPane.showMessageDialog(getFrame(), ex.getMessage());
			} catch (ArrayIndexOutOfBoundsException ex) {
				JOptionPane.showMessageDialog(getFrame(), "RAW Image Dimensions wrong!");
			}
		}
		//this.confirmOperation = false;
		//jIFrameBrowseImages.setVisible(false);
	}//GEN-LAST:event_jMenuItemAddImagesActionPerformed

	private void jMenuItemSubImagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSubImagesActionPerformed
		BufferedImage substrahend;
		ImageProcessor.CompressAlgorithm selectedAlgorithm;
		int chooseOption = jImageFileChooser.showOpenDialog(menuBar);
		
		if ((chooseOption == JFileChooser.APPROVE_OPTION)) {
			try {
				File imageFile = jImageFileChooser.getSelectedFile();
				substrahend = GUIImageOpenManagement(imageFile);
				selectedAlgorithm = AlgorithmSelectionManager();
				this.processImage = ImageProcessor.sub(this.processImage, substrahend,selectedAlgorithm);
				this.imageHistogram = new Histogram(this.processImage);
				displayImage();
			} catch (IOException ex) {
				JOptionPane.showMessageDialog(getFrame(), ex.getMessage());
			} catch (ArrayIndexOutOfBoundsException ex) {
				JOptionPane.showMessageDialog(getFrame(), "RAW Image Dimensions wrong!");
			}
		}
	}//GEN-LAST:event_jMenuItemSubImagesActionPerformed

	private void jMenuItemNegativeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNegativeActionPerformed
		if (this.processImage == null) {
			JOptionPane.showMessageDialog(getFrame(), "Error, No image present, you must open an image file first", "Image not found",JOptionPane.ERROR_MESSAGE);
		} else {
			this.processImage = ImageProcessor.negative(this.processImage);
			this.imageHistogram = new Histogram(this.processImage);
			displayImage();
		}
	}//GEN-LAST:event_jMenuItemNegativeActionPerformed

	private void jMenuItemHistogramActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemHistogramActionPerformed
		BufferedImage histImage;
		
		if (this.processImage == null) {
			JOptionPane.showMessageDialog(getFrame(), "Error, No image present, you must open an image file first", "Image not found",JOptionPane.ERROR_MESSAGE);
		} else {
			if (this.imageHistogram == null) {
				this.imageHistogram = new Histogram(this.processImage);
			}
			histImage = this.imageHistogram.getHistogram();
			jImageContainer.setIcon(new ImageIcon(histImage));
			jImageShowCasePanel.setPreferredSize(new Dimension(histImage.getWidth(), histImage.getHeight()));
			jImageShowCasePanel.setMaximumSize(new Dimension(histImage.getWidth(), histImage.getHeight()));
		}
	}//GEN-LAST:event_jMenuItemHistogramActionPerformed

	private void jMenuItemEqualizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemEqualizeActionPerformed
		if (this.processImage == null) {
			JOptionPane.showMessageDialog(getFrame(), "Error, No image present, you must open an image file first", "Image not found",JOptionPane.ERROR_MESSAGE);
		} else {
			this.processImage = ImageProcessor.enhanceContrast(this.processImage);
			this.imageHistogram = new Histogram(this.processImage);
			displayImage();
		}
	}//GEN-LAST:event_jMenuItemEqualizeActionPerformed

	private void jMenuItemDRangeCompressionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDRangeCompressionActionPerformed
		if (this.processImage == null) {
			JOptionPane.showMessageDialog(getFrame(), "Error, No image present, you must open an image file first", "Image not found",JOptionPane.ERROR_MESSAGE);
		} else {
			this.processImage = ImageProcessor.DynamicRangeCompression(this.processImage);
			this.imageHistogram = new Histogram(this.processImage);
			displayImage();
		}
	}//GEN-LAST:event_jMenuItemDRangeCompressionActionPerformed

	private void jMenuItemThresholdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemThresholdActionPerformed
		if (this.processImage == null) {
			JOptionPane.showMessageDialog(getFrame(), "Error, No image present, you must open an image file first", "Image not found",JOptionPane.ERROR_MESSAGE);
		} else {
			try {
				int thresholdValue = Integer.parseInt(JOptionPane.showInputDialog(getFrame(), "Threshold Value?"));
				this.processImage = ImageProcessor.threshold(this.processImage, thresholdValue);
				this.imageHistogram = new Histogram(this.processImage);
				displayImage();
			} catch (NumberFormatException ex){
				JOptionPane.showMessageDialog(getFrame(), "Error, integer number expected", "Input Error",JOptionPane.ERROR_MESSAGE);
			}
		}
	}//GEN-LAST:event_jMenuItemThresholdActionPerformed

	private void jMenuItemProductActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemProductActionPerformed
		BufferedImage operand;
		int chooseOption = jImageFileChooser.showOpenDialog(menuBar);
		ImageProcessor.CompressAlgorithm selectedAlgorithm;
		
		if ((chooseOption == JFileChooser.APPROVE_OPTION)) {
			try {
				File imageFile = jImageFileChooser.getSelectedFile();
				operand = GUIImageOpenManagement(imageFile);
				selectedAlgorithm = AlgorithmSelectionManager();
				this.processImage = ImageProcessor.product(this.processImage, operand, selectedAlgorithm);
				this.imageHistogram = new Histogram(this.processImage);
				displayImage();
			} catch (IOException ex) {
				JOptionPane.showMessageDialog(getFrame(), ex.getMessage());
			} catch (ArrayIndexOutOfBoundsException ex) {
				JOptionPane.showMessageDialog(getFrame(), "RAW Image Dimensions wrong!");
			}
		}
	}//GEN-LAST:event_jMenuItemProductActionPerformed

	private void jMenuItemScalarProductActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemScalarProductActionPerformed
		ImageProcessor.CompressAlgorithm selectedAlgorithm;
		
		if (this.processImage == null) {
			JOptionPane.showMessageDialog(getFrame(), "Error, No image present, you must open an image file first", "Image not found",JOptionPane.ERROR_MESSAGE);
		} else {
			try {
				int scalarValue = Integer.parseInt(JOptionPane.showInputDialog(getFrame(), "Threshold Value?"));
				selectedAlgorithm = AlgorithmSelectionManager();
				this.processImage = ImageProcessor.scalarProduct(this.processImage, scalarValue, selectedAlgorithm);
				this.imageHistogram = new Histogram(this.processImage);
				displayImage();
			} catch (NumberFormatException ex){
				JOptionPane.showMessageDialog(getFrame(), "Error, integer number expected", "Input Error",JOptionPane.ERROR_MESSAGE);
			}
		}
	}//GEN-LAST:event_jMenuItemScalarProductActionPerformed

	private void jMenuItemSaveImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSaveImageActionPerformed
		ResourceMap rmap = getResourceMap();
		String errmsg;
		boolean saveError;

		if (imgFile == null) {
			errmsg = rmap.getString("jSaveFailedFileNull.text");
			saveError = true;
		} else if (processImage == null) {
			errmsg = rmap.getString("jSaveFailedImageNull.text");
			saveError = true;
		} else if (!imgUtil.saveImage(imgFile, processImage)) {
			errmsg = rmap.getString("jSaveFailedIO.text");
			saveError = true;
		} else {
			saveError = false;
			errmsg = null;
		}

		if (saveError) {
			JOptionPane.showMessageDialog(getFrame(), errmsg, "Error during save", JOptionPane.ERROR_MESSAGE);
		}
	}//GEN-LAST:event_jMenuItemSaveImageActionPerformed

	private void jMenuItemSaveImageAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSaveImageAsActionPerformed
		int chooseOption = jImageFileChooser.showSaveDialog(menuBar);
		
		if ((chooseOption == JFileChooser.APPROVE_OPTION)) {
			File imageFile = jImageFileChooser.getSelectedFile();
			if (processImage == null || !imgUtil.saveImage(imageFile, processImage)) {
				JOptionPane.showMessageDialog(getFrame(), "Error saving image file", "Error during save", JOptionPane.ERROR_MESSAGE);
			} else {
				this.imgFile = imageFile;
				imgUtil.saveImage(imageFile, processImage);
			}
		}
	}//GEN-LAST:event_jMenuItemSaveImageAsActionPerformed

	private void jMenuItemGaussianNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGaussianNoiseActionPerformed
		double mean, stdDev;
		int percentage;
		
		jTwoDoubleArgumentDialog meanAndStdDev = new jTwoDoubleArgumentDialog(getFrame(), getResourceMap(),
			"Mean", "Standard Deviation");
		meanAndStdDev.setVisible(true);
		mean = meanAndStdDev.getInputArg1();
		stdDev = meanAndStdDev.getInputArg2();
		BlankAdditiveGaussianNoise gaussianNoise = new BlankAdditiveGaussianNoise(mean, stdDev);
		jSingleArgumentDialog percentDialog = new jSingleArgumentDialog(getFrame(), getResourceMap(), "Noise Percentage");
		percentDialog.setVisible(true);
		percentage = percentDialog.getInputArg();
		processImage = gaussianNoise.addNoise(processImage, ImageProcessor.CompressAlgorithm.LINEAR,percentage);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemGaussianNoiseActionPerformed

	private void jMenuItemMultExponentialNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMultExponentialNoiseActionPerformed
		double lambda;
		jSingleDoubleArgumentDialog lambdaArg = new jSingleDoubleArgumentDialog(getFrame(), getResourceMap(), "Lambda");
		lambdaArg.setVisible(true);
		lambda = lambdaArg.getInputArg();
		MultiplicativeExponentialNoise mexpnoise = new MultiplicativeExponentialNoise(lambda);
		processImage = mexpnoise.addNoise(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemMultExponentialNoiseActionPerformed

	private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
		double variance;
		jSingleDoubleArgumentDialog lambdaArg = new jSingleDoubleArgumentDialog(getFrame(), getResourceMap(), "Variance");
		lambdaArg.setVisible(true);
		variance = lambdaArg.getInputArg();
		MultiplicativeRayleighNoise rnoise = new MultiplicativeRayleighNoise(variance);
		processImage = rnoise.addNoise(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem1ActionPerformed

	private void jMenuItemSaltAndPepperActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSaltAndPepperActionPerformed
		double p0, p1;
		jTwoDoubleArgumentDialog noiseProbabilities = new jTwoDoubleArgumentDialog(getFrame(),
			getResourceMap(), "p0", "p1");
		
		noiseProbabilities.setVisible(true);
		p0 = noiseProbabilities.getInputArg1();
		p1 = noiseProbabilities.getInputArg2();
		
		SaltAndPepperNoise saltpeppernoise = new SaltAndPepperNoise(p0, p1);
		processImage = saltpeppernoise.addNoise(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemSaltAndPepperActionPerformed

	private void jMenuItemMeanFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMeanFilterActionPerformed
		int dim;
		jSingleArgumentDialog meanDimensionDialog = new jSingleArgumentDialog(getFrame(), 
			getResourceMap(), "Dimension");
		
		meanDimensionDialog.setVisible(true);
		dim = meanDimensionDialog.getInputArg();
		
		MeanFilter filter = new MeanFilter(dim);
		processImage = filter.applyFilter(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemMeanFilterActionPerformed

	private void jMenuItemMedianFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMedianFilterActionPerformed
		int dim;
		jSingleArgumentDialog meanDimensionDialog = new jSingleArgumentDialog(getFrame(), 
			getResourceMap(), "Dimension");
		
		meanDimensionDialog.setVisible(true);
		dim = meanDimensionDialog.getInputArg();
		MedianFilter filter = new MedianFilter(dim);
		processImage = filter.applyFilter(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemMedianFilterActionPerformed

	private void jMenuItemHighPassFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemHighPassFilterActionPerformed
		int dim;
		jSingleArgumentDialog meanDimensionDialog = new jSingleArgumentDialog(getFrame(), 
			getResourceMap(), "Dimension");
		
		meanDimensionDialog.setVisible(true);
		dim = meanDimensionDialog.getInputArg();
		HighPassFilter filter = new HighPassFilter(dim);
		processImage = filter.applyFilter(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemHighPassFilterActionPerformed

	private void jMenuItemRobertsEdgeDetectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRobertsEdgeDetectionActionPerformed
		EdgeDetector edgedetector = new RobertsEdgeDetector(processImage);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemRobertsEdgeDetectionActionPerformed

	private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
		processImage = imgUtil.addPaddingEdge(processImage, 1);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem2ActionPerformed

	private void jMenuItemPrewittEdgeDetectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemPrewittEdgeDetectionActionPerformed
		EdgeDetector edgedetector = new PrewittEdgeDetector(processImage);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemPrewittEdgeDetectionActionPerformed

	private void jMenuItemSobelEdgeDetectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSobelEdgeDetectionActionPerformed
		EdgeDetector edgedetector = new SobelEdgeDetector(processImage);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemSobelEdgeDetectionActionPerformed

	private void jMenuItemAnisotropicDiffussionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAnisotropicDiffussionActionPerformed
		int kappa, t;
		jTwoArgumentDialog anisotropicArgs = new jTwoArgumentDialog(getFrame(), getResourceMap(), "Kappa", "Iterations");
		anisotropicArgs.setVisible(true);
		kappa = anisotropicArgs.getInputArg1();
		t = anisotropicArgs.getInputArg2();
		Diffusion diff = new AnisotropicDiffussion(processImage, kappa, t);
		processImage = diff.diffuse();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemAnisotropicDiffussionActionPerformed

	private void jMenuItemGreyScaleDegradeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGreyScaleDegradeActionPerformed
		int width, height;
		jTwoArgumentDialog degradeSize = new jTwoArgumentDialog(getFrame(), getResourceMap(), "Height", "Width");
		degradeSize.setVisible(true);
		width = degradeSize.getInputArg2();
		height = degradeSize.getInputArg1();
		processImage = imgUtil.createDegrade(height, width);
		displayImage();
	}//GEN-LAST:event_jMenuItemGreyScaleDegradeActionPerformed

	private void jMenuItemColorDegradeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemColorDegradeActionPerformed
		int width, height;
		jTwoArgumentDialog degradeSize = new jTwoArgumentDialog(getFrame(), getResourceMap(), "Height", "Width");
		
		degradeSize.setVisible(true);
		Color startColor = JColorChooser.showDialog(getFrame(), "Choose Initial Color", Color.WHITE);
		Color endColor = JColorChooser.showDialog(getFrame(), "Choose Ending Color", Color.WHITE);
		if (startColor != null && endColor != null) {
			width = degradeSize.getInputArg2();
			height = degradeSize.getInputArg1();
			processImage = imgUtil.createDegrade(height, width, startColor, endColor );
			displayImage();
		}
		
	}//GEN-LAST:event_jMenuItemColorDegradeActionPerformed

	private void jMenuItemIsotropicDiffusionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemIsotropicDiffusionActionPerformed
		int kappa, t;
		jTwoArgumentDialog isotropicArgs = new jTwoArgumentDialog(getFrame(), getResourceMap(), "Kappa", "Iterations");
		isotropicArgs.setVisible(true);
		kappa = isotropicArgs.getInputArg1();
		t = isotropicArgs.getInputArg2();
		Diffusion diff = new IsotropicDiffussion(processImage, kappa, t);
		processImage = diff.diffuse();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemIsotropicDiffusionActionPerformed

	private void jMenuItemGaussianFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemGaussianFilterActionPerformed
		double sigmaSquared;
		
		jSingleDoubleArgumentDialog sigmaArgument = new jSingleDoubleArgumentDialog(getFrame(), getResourceMap(), 
			"Sigma Squared");
		sigmaArgument.setVisible(true);
		sigmaSquared = sigmaArgument.getInputArg();
		Filter gaussFilter = new GaussianFilter(sigmaSquared);
		processImage = gaussFilter.applyFilter(processImage, ImageProcessor.CompressAlgorithm.LINEAR);
		displayImage();
		
	}//GEN-LAST:event_jMenuItemGaussianFilterActionPerformed

	private void jMenuItemLaplacianEdgeDetectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLaplacianEdgeDetectorActionPerformed
		double threshold;
		
		jSingleDoubleArgumentDialog thresholdArg = new jSingleDoubleArgumentDialog(getFrame(), getResourceMap(), 
			"threshold");
		thresholdArg.setVisible(true);
		threshold = thresholdArg.getInputArg();
		EdgeDetector edgedetector = new ZeroCrossEdgeDetection(processImage, threshold);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemLaplacianEdgeDetectorActionPerformed

	private void jLogEdgeDetectionMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jLogEdgeDetectionMenuItemActionPerformed
		double threshold, sigma;
		
		jSliderDialog sliderDialog = new jSliderDialog(getFrame(), getResourceMap());
		jSingleDoubleArgumentDialog stdDialog = new jSingleDoubleArgumentDialog(getFrame(), getResourceMap(), "Standard Deviation");
		sliderDialog.setVisible(true);
		threshold = sliderDialog.getSliderValue();
		stdDialog.setVisible(true);
		sigma = stdDialog.getInputArg();
		EdgeDetector edgedetector = new LogEdgeDetector(processImage, sigma, threshold);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jLogEdgeDetectionMenuItemActionPerformed

	private void jCannyEdgeDetectionMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCannyEdgeDetectionMenuItemActionPerformed
		double t1, t2, sigma;
		
		jTwoDoubleArgumentDialog thresholdsDialog = new jTwoDoubleArgumentDialog(getFrame(), getResourceMap(), "Low threshold", "High threshold");
		jSingleDoubleArgumentDialog sigmaDialog = new jSingleDoubleArgumentDialog(getFrame(), getResourceMap(), "Sigma Value");
		
		thresholdsDialog.setVisible(true);
		
		t1 = thresholdsDialog.getInputArg1();
		t2 = thresholdsDialog.getInputArg2();
		sigmaDialog.setVisible(true);
		
		sigma = sigmaDialog.getInputArg();
		
		EdgeDetector edgedetector = new CannyEdgeDetector(processImage, sigma, t1, t2);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jCannyEdgeDetectionMenuItemActionPerformed

	private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
		EdgeDetector.DIRECCTION dir;
		jDirectionDialog dirDialog = new jDirectionDialog(getFrame(), getResourceMap());
		
		dirDialog.setVisible(true);
		dir = dirDialog.getDirection();
		EdgeDetector edgedetector = new AEdgeDetector(processImage, dir);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem3ActionPerformed

	private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
				EdgeDetector.DIRECCTION dir;
		jDirectionDialog dirDialog = new jDirectionDialog(getFrame(), getResourceMap());
		
		dirDialog.setVisible(true);
		dir = dirDialog.getDirection();
		EdgeDetector edgedetector = new BKirshEdgeDetector(processImage, dir);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem4ActionPerformed

	private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
		EdgeDetector.DIRECCTION dir;
		jDirectionDialog dirDialog = new jDirectionDialog(getFrame(), getResourceMap());
		
		dirDialog.setVisible(true);
		dir = dirDialog.getDirection();
		EdgeDetector edgedetector = new CEdgeDetector(processImage, dir);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem5ActionPerformed

	private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
		EdgeDetector.DIRECCTION dir;
		jDirectionDialog dirDialog = new jDirectionDialog(getFrame(), getResourceMap());
		
		dirDialog.setVisible(true);
		dir = dirDialog.getDirection();
		EdgeDetector edgedetector = new DEdgeDetector(processImage, dir);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem6ActionPerformed

	private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
		double rho, theta, epsilon, percent;
		
		jFourDoubleArgumentDialog houghArgsDialog = new jFourDoubleArgumentDialog(getFrame(), getResourceMap(), 
			"Rho", "Theta", "epsilon", "percent");
		
		houghArgsDialog.setVisible(true);
		rho = houghArgsDialog.getInputArg1();
		theta = houghArgsDialog.getInputArg2();
		epsilon = houghArgsDialog.getInputArg3();
		percent = houghArgsDialog.getInputArg4();
		
		Hough h = new Hough((int)rho, (int)theta, (float)epsilon, processImage, (int)percent);
		processImage = h.findLines();
		imageHistogram = new Histogram(processImage);
		displayImage();
		
	}//GEN-LAST:event_jMenuItem7ActionPerformed

	private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
		double centerA, centerB, radious, percent, epsilon;
		
		jFiveDoubleArgumentDialog houghArgsDialog = new jFiveDoubleArgumentDialog(getFrame(), getResourceMap(), 
			"Center A", "Center B", "Radious", "epsilon", "percent");
		
		houghArgsDialog.setVisible(true);
		centerA = houghArgsDialog.getInputArg1();
		centerB = houghArgsDialog.getInputArg2();
		radious = houghArgsDialog.getInputArg3();
		epsilon = houghArgsDialog.getInputArg4();
		percent = houghArgsDialog.getInputArg5();
		
		HoughCircles ch = new HoughCircles((int)centerA, (int)centerB, (int)radious, (float)epsilon, processImage, (int)percent);
		processImage = ch.findCircles();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem8ActionPerformed

	private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
		SUSAN_TYPES type;
		double threshold, tolerance;
		
		jSusanDialog susanDialog = new jSusanDialog(getFrame(), getResourceMap());
		jTwoDoubleArgumentDialog susanArgs = new jTwoDoubleArgumentDialog(getFrame(), getResourceMap(), 
			"Threshold", "Tolerance");
		susanDialog.setVisible(true);
		type = susanDialog.getSusanType();
		boolean over =  susanDialog.getOverImage();
		susanArgs.setVisible(true);
		
		threshold = susanArgs.getInputArg1();
		tolerance = susanArgs.getInputArg2();
		
		EdgeDetector edgedetector = new SusanEdgeDetector(processImage, (int)threshold, type, (float)tolerance,over);
		processImage = edgedetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem9ActionPerformed

	private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
		OtsuThresholderA ota = new OtsuThresholderA();
		
		ota.doThreshold(processImage);
		processImage = ImageProcessor.threshold(processImage, ota.getThreshold());
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem10ActionPerformed

	private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
		GlobalThresholder gt = new GlobalThresholder();
		
		int threshold = gt.findThresholdValue(processImage);
		processImage = ImageProcessor.threshold(processImage, threshold);
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItem11ActionPerformed

	private void jMenuItemHarrisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemHarrisActionPerformed
		EdgeDetector edgeDetector = new HarrisCornerDetector(processImage);
		
		processImage = edgeDetector.FindEdges();
		imageHistogram = new Histogram(processImage);
		displayImage();
	}//GEN-LAST:event_jMenuItemHarrisActionPerformed

private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed
	
	double centerx,centery,widthrectangle,heightrectangle,withimage,heightimage;
	
	jSixDoubleArgumentDialog rectangleArgs = new jSixDoubleArgumentDialog(getFrame(), getResourceMap(), 
			"Center X", "Center Y", "Width Rectangle", "Height Rectangle", "Width Image", "Height Image");
	rectangleArgs.setVisible(true);
	centerx = rectangleArgs.getInputArg1();
	centery = rectangleArgs.getInputArg2();
	widthrectangle = rectangleArgs.getInputArg3();
	heightrectangle = rectangleArgs.getInputArg4();
	withimage = rectangleArgs.getInputArg5();
	heightimage = rectangleArgs.getInputArg6();
	
	processImage = ShapesGenerators.generateRectangle((int)centerx, (int)centery, (int)widthrectangle, (int)heightrectangle, (int)withimage, (int)heightimage);
	imageHistogram = new Histogram(processImage);
	displayImage();
}//GEN-LAST:event_jMenuItem12ActionPerformed

private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed

	double rWidth, rHeight, iWidht,iHeigh;
	jFourDoubleArgumentDialog rectangleCenterArgs = new jFourDoubleArgumentDialog(getFrame(), getResourceMap(),"Rectangle Width" , "Rectangle Height", "Image Width", "Image Height");
	rectangleCenterArgs.setVisible(true);
	rWidth = rectangleCenterArgs.getInputArg1();
	rHeight = rectangleCenterArgs.getInputArg2();
	iWidht = rectangleCenterArgs.getInputArg3();
	iHeigh = rectangleCenterArgs.getInputArg4();
	
	processImage = ShapesGenerators.generateRectangle((int)rWidth, (int)rHeight, (int)iWidht, (int)iHeigh);
	imageHistogram = new Histogram(processImage);
	displayImage();
}//GEN-LAST:event_jMenuItem13ActionPerformed

private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed
	

	double rWidth, rHeight, iWidht,iHeigh,theta;
	jFiveDoubleArgumentDialog rectangleCenterArgs = new jFiveDoubleArgumentDialog(getFrame(), getResourceMap(),"Rectangle Width" , "Rectangle Height", "Image Width", "Image Height","Angle");
	rectangleCenterArgs.setVisible(true);
	rWidth = rectangleCenterArgs.getInputArg1();
	rHeight = rectangleCenterArgs.getInputArg2();
	iWidht = rectangleCenterArgs.getInputArg3();
	iHeigh = rectangleCenterArgs.getInputArg4();
	theta = rectangleCenterArgs.getInputArg5();
	
	
	processImage = ShapesGenerators.generateRectangleRotated((int)rWidth, (int)rHeight, (int)iWidht, (int)iHeigh,theta);
	imageHistogram = new Histogram(processImage);
	displayImage();

}//GEN-LAST:event_jMenuItem14ActionPerformed

private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem15ActionPerformed

	double rSide, iSide;
	jTwoDoubleArgumentDialog squareDialog = new jTwoDoubleArgumentDialog(getFrame(), getResourceMap(),"Rectangle side" , "Image size");
	squareDialog.setVisible(true);
	rSide = squareDialog.getInputArg1();
	iSide = squareDialog.getInputArg2();
	
	processImage = ShapesGenerators.generateSquare((int)rSide, (int)iSide, (int)iSide);
	imageHistogram = new Histogram(processImage);
	displayImage();
}//GEN-LAST:event_jMenuItem15ActionPerformed

private void jMenuItem17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem17ActionPerformed
	
	double rSide, iSide;
	jTwoDoubleArgumentDialog squareDialog = new jTwoDoubleArgumentDialog(getFrame(), getResourceMap(),"Lines Separation" , "Image size");
	squareDialog.setVisible(true);
	rSide = squareDialog.getInputArg1();
	iSide = squareDialog.getInputArg2();
	
	processImage = ShapesGenerators.generateLines((int)rSide, (int)iSide, (int)iSide);
	imageHistogram = new Histogram(processImage);
	displayImage();
}//GEN-LAST:event_jMenuItem17ActionPerformed

private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed
	double rSide, iSide;
	jTwoDoubleArgumentDialog squareDialog = new jTwoDoubleArgumentDialog(getFrame(), getResourceMap(),"Lines Separation" , "Image size");
	squareDialog.setVisible(true);
	rSide = squareDialog.getInputArg1();
	iSide = squareDialog.getInputArg2();
	
	processImage = ShapesGenerators.generateDiagonalLines((int)rSide, (int)iSide, (int)iSide);
	imageHistogram = new Histogram(processImage);
	displayImage();
}//GEN-LAST:event_jMenuItem16ActionPerformed

private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed

	double a,b,r,iWidht,iHeight;
	jFiveDoubleArgumentDialog circleDialog = new jFiveDoubleArgumentDialog(getFrame(), getResourceMap(), "X Center", "Y Center", "Radius", "Image Widht", "Image Height");
	circleDialog.setVisible(true);
	
	a=circleDialog.getInputArg1();
	b=circleDialog.getInputArg2();
	r=circleDialog.getInputArg3();
	iWidht = circleDialog.getInputArg4();
	iHeight = circleDialog.getInputArg5();
	processImage = ShapesGenerators.drawCircle((int)a,(int) b, (int)r, (int)iWidht, (int)iHeight);
	imageHistogram = new Histogram(processImage);
	displayImage();
	
}//GEN-LAST:event_jMenuItem18ActionPerformed

	private void displayImage() {
		jImageContainer.setIcon(new ImageIcon(this.processImage));
		jImageShowCasePanel.setPreferredSize(new Dimension(this.processImage.getWidth(), this.processImage.getHeight()));
		jImageShowCasePanel.setMaximumSize(new Dimension(this.processImage.getWidth(), this.processImage.getHeight()));
	}
	private BufferedImage GUIImageOpenManagement(File imageFile) throws IOException, ArrayIndexOutOfBoundsException {
		BufferedImage ret;
		int height, width;
		boolean color;
		
		if (imageFile.getName().toUpperCase().endsWith(".RAW")) {
			jRawImageDialog rawImageDialog = new jRawImageDialog(getFrame(), getResourceMap());
			rawImageDialog.setVisible(true);
			height = rawImageDialog.getRawHeight();
			width = rawImageDialog.getRawWidth();
			color = rawImageDialog.isColor();
			
			ret = imgUtil.openRawImage(imageFile, height, width, color);
		} else if (imageFile.getName().toUpperCase().endsWith(".PGM")) {
			ret = imgUtil.openPgmImage(imgFile, false);
		} else {
			ret =  imgUtil.openImage(imageFile);
		}
		return ret;
	}
	
	private ImageProcessor.CompressAlgorithm AlgorithmSelectionManager() {
		jCompressionAlgorithmDialog algorithmDialog = new jCompressionAlgorithmDialog(getFrame(), getResourceMap());
		algorithmDialog.setVisible(true);
		
		return algorithmDialog.getAlgorithm();
	}
	
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem jCannyEdgeDetectionMenuItem;
    private javax.swing.JLabel jImageContainer;
    private javax.swing.JFileChooser jImageFileChooser;
    private javax.swing.JDesktopPane jImageShowCaseDPane;
    private javax.swing.JPanel jImageShowCasePanel;
    private javax.swing.JMenuItem jLogEdgeDetectionMenuItem;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenuCorners;
    private javax.swing.JMenu jMenuDiffusion;
    private javax.swing.JMenu jMenuEdges;
    private javax.swing.JMenu jMenuFilters;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JMenuItem jMenuItemAddImages;
    private javax.swing.JMenuItem jMenuItemAnisotropicDiffussion;
    private javax.swing.JMenuItem jMenuItemColorDegrade;
    private javax.swing.JMenuItem jMenuItemDRangeCompression;
    private javax.swing.JMenuItem jMenuItemEqualize;
    private javax.swing.JMenuItem jMenuItemGaussianFilter;
    private javax.swing.JMenuItem jMenuItemGaussianNoise;
    private javax.swing.JMenuItem jMenuItemGreyScaleDegrade;
    private javax.swing.JMenuItem jMenuItemHarris;
    private javax.swing.JMenuItem jMenuItemHighPassFilter;
    private javax.swing.JMenuItem jMenuItemHistogram;
    private javax.swing.JMenuItem jMenuItemIsotropicDiffusion;
    private javax.swing.JMenuItem jMenuItemLaplacianEdgeDetector;
    private javax.swing.JMenuItem jMenuItemMeanFilter;
    private javax.swing.JMenuItem jMenuItemMedianFilter;
    private javax.swing.JMenuItem jMenuItemMultExponentialNoise;
    private javax.swing.JMenuItem jMenuItemNegative;
    private javax.swing.JMenuItem jMenuItemOpen;
    private javax.swing.JMenuItem jMenuItemPrewittEdgeDetection;
    private javax.swing.JMenuItem jMenuItemProduct;
    private javax.swing.JMenuItem jMenuItemRobertsEdgeDetection;
    private javax.swing.JMenuItem jMenuItemSaltAndPepper;
    private javax.swing.JMenuItem jMenuItemSaveImage;
    private javax.swing.JMenuItem jMenuItemSaveImageAs;
    private javax.swing.JMenuItem jMenuItemScalarProduct;
    private javax.swing.JMenuItem jMenuItemSobelEdgeDetection;
    private javax.swing.JMenuItem jMenuItemSubImages;
    private javax.swing.JMenuItem jMenuItemThreshold;
    private javax.swing.JMenu jMenuNoise;
    private javax.swing.JMenu jMenuOperations;
    private javax.swing.JMenu jMenuStatistics;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}
